home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / debugger / ddd-1.000 / ddd-1 / ddd-1.4b / ddd / ScrolledGE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-21  |  5.6 KB  |  161 lines

  1. // $Id: ScrolledGE.C,v 1.7 1995/11/21 13:50:54 zeller Exp $  -*- C++ -*-
  2. // Scrolled Graph Editor
  3.  
  4. // Copyright (C) 1995 Technische Universitaet Braunschweig, Germany.
  5. // Written by Andreas Zeller (zeller@ips.cs.tu-bs.de).
  6. // 
  7. // This file is part of the DDD Library.
  8. // 
  9. // The DDD Library is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU Library General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2 of the License, or (at your option) any later version.
  13. // 
  14. // The DDD Library is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. // See the GNU Library General Public License for more details.
  18. // 
  19. // You should have received a copy of the GNU Library General Public
  20. // License along with the DDD Library -- see the file COPYING.LIB.
  21. // If not, write to the Free Software Foundation, Inc.,
  22. // 675 Mass Ave, Cambridge, MA 02139, USA.
  23. // 
  24. // DDD is the data display debugger.
  25. // For details, see the DDD World-Wide-Web page, 
  26. // `http://www.cs.tu-bs.de/softech/ddd/',
  27. // or send a mail to the DDD developers at `ddd@ips.cs.tu-bs.de'.
  28.  
  29. char ScrolledGraphEdit_rcsid[] = 
  30.     "$Id: ScrolledGE.C,v 1.7 1995/11/21 13:50:54 zeller Exp $";
  31.  
  32. #ifdef __GNUG__
  33. #pragma implementation
  34. #endif
  35.  
  36. #include <iostream.h>
  37. #include "ScrolleGEP.h"
  38. #include "GraphEdit.h"
  39. #include "verify.h"
  40.  
  41. #define EVERYWHERE (BoxRegion(BoxPoint(0,0), BoxSize(INT_MAX, INT_MAX)))
  42.  
  43.  
  44. // Method function declarations
  45.  
  46. static void Resize(Widget w);
  47.  
  48.  
  49. // Class record initialization
  50.  
  51. ScrolledGraphEditClassRec scrolledGraphEditClassRec = {
  52.   {     /* core fields */
  53.     /* superclass               */  xmScrolledWindowWidgetClass,
  54.     /* class_name               */  "ScrolledGraphEdit",
  55.     /* widget_size              */  sizeof(ScrolledGraphEditRec),
  56.     /* class_initialize         */  XtProc(0),
  57.     /* class_part_initialize    */  XtWidgetClassProc(0),
  58.     /* class_inited             */  False,
  59.     /* initialize               */  XtInitProc(0),
  60.     /* initialize_hook          */  XtArgsProc(0),
  61.     /* realize                  */  XtInheritRealize,
  62.     /* actions                  */  NULL,
  63.     /* num_actions              */  0,
  64.     /* resources                */  NULL,
  65.     /* num_resources            */  0,
  66.     /* xrm_class                */  NULLQUARK,
  67.     /* compress_motion          */  True,
  68.     /* compress_exposure        */  True,
  69.     /* compress_enterleave      */  True,
  70.     /* visible_interest         */  False,
  71.     /* destroy                  */  XtWidgetProc(0),
  72.     /* resize                   */  Resize,
  73.     /* expose                   */  XtInheritExpose,
  74.     /* set_values               */  XtSetValuesFunc(0),
  75.     /* set_values_hook          */  XtArgsFunc(0),
  76.     /* set_values_almost        */  XtInheritSetValuesAlmost,
  77.     /* get_values_hook          */  XtArgsProc(0),
  78.     /* accept_focus             */  XtAcceptFocusProc(0),
  79.     /* version                  */  XtVersion,
  80.     /* callback_private         */  NULL,
  81.     /* tm_table                 */  NULL,
  82.     /* query_geometry           */  XtInheritQueryGeometry,
  83.     /* display_accelerator      */  XtInheritDisplayAccelerator,
  84.     /* extension                */  NULL,
  85.   },
  86.   {     /* Composite fields */
  87.     /* geometry_manager         */  XtInheritGeometryManager,
  88.     /* change_managed           */  XtInheritChangeManaged,
  89.     /* insert_child             */  XtInheritInsertChild,
  90.     /* delete_child             */  XtInheritDeleteChild,
  91.     /* extension                */  NULL,
  92.   },
  93.   {     /* Constraint fields */
  94.     /* resources                */  NULL,
  95.     /* num_resources            */  0,
  96.     /* constraint_size          */  0,
  97.     /* initialize               */  XtInitProc(0),
  98.     /* destroy                  */  XtWidgetProc(0),
  99.     /* set_values               */  XtSetValuesFunc(0),
  100.     /* extension                */  NULL,
  101.   },
  102.   {     /* Manager fields */
  103.     /* translations             */  XtInheritTranslations,
  104.     /* syn_resources            */  NULL,
  105.     /* num_syn_resources        */  0,
  106.     /* syn_constraint_resources */  NULL,
  107.     /* num_syn_constraint_res   */  0,
  108.     /* parent_process           */  XmInheritParentProcess,
  109.     /* extension                */  NULL,
  110.   },
  111.   {     /* Scrolled window fields */
  112.     /* mumble                   */  0,
  113.   },
  114.   {    /* ScrolledGraphEdit fields */
  115.     /* extension                */  0,
  116.   },
  117. };
  118.  
  119. WidgetClass scrolledGraphEditWidgetClass = 
  120.     (WidgetClass)&scrolledGraphEditClassRec;
  121.  
  122.  
  123. static void Resize(Widget w)
  124. {
  125.     // resize child if it's a graphEdit child
  126.     Widget child = ScrolledGraphEditWidget(w)->swindow.WorkWindow;
  127.     if (child && XtIsSubclass(child, graphEditWidgetClass))
  128.     graphEditSizeChanged(child);
  129.  
  130.     // call superclass resize method
  131.     scrolledGraphEditClassRec.core_class.superclass->core_class.resize(w);
  132. }
  133.  
  134.  
  135. Widget createScrolledGraphEdit(Widget parent, String name,
  136.                    ArgList arglist, Cardinal argcount)
  137. {
  138.     Arg args[10];
  139.     int arg = 0;
  140.  
  141.     XtSetArg(args[arg], XmNscrollingPolicy, XmAUTOMATIC); arg++;
  142.     string swindow_name = string(name) + "_swindow";
  143.  
  144. #if XmVersion >= 2000
  145.     // In Motif 2.0 or later, the definition above crashes.
  146.     // Use a standard scrolled window instead.
  147.     Widget scrolledWindow = 
  148.     verify(XtCreateManagedWidget((char *)swindow_name, 
  149.                      xmScrolledWindowWidgetClass,
  150.                      parent, args, arg));
  151. #else
  152.     Widget scrolledWindow = 
  153.     verify(XtCreateManagedWidget((char *)swindow_name, 
  154.                      scrolledGraphEditWidgetClass,
  155.                      parent, args, arg));
  156. #endif
  157.  
  158.     return verify(XtCreateManagedWidget(name, graphEditWidgetClass,
  159.                     scrolledWindow, arglist, argcount));
  160. }
  161.